#include <iostream>
using namespace std;
#include<string>
int main()
{
    string s;
    //ci<<s;
    getline(cin,s);

    size_t pos=s.rfind(' ');
    cout<<s.size()-1-pos<<endl;
    return 0;
}

